Test PR to bisect performance issue pre 2.22.4 - #1185
Conversation
Update expected test results after frontend update
Update MISRA queries and tests after merging location tables
C++: accept new test results after QL changes
Observe that `sizeof(...)` might not occur as a dataflow node if it has a parent node with a concrete value. That value will be a dataflow node instead. Hence, the query has be changed to check for expressions where `sizeof(...)` is a child of an expression with a concrete value.
Note that we now properly report the offending cast instead of the expression that is being cast.
As it is the dataflow used by `asctime` that is relevant, and not the pointer, use the indirect expression.
Convert a number of queries to use the new dataflow library
Update expected test results for MSC33-C
These use the new dataflow library
Since the new dataflow library uses use-use dataflow and not def-use dataflow, we now need to check for definitions. Note that these queries can probably be improved by using a dataflow configuration - possibly limited to the local context of a function by including `DataFlow::FeatureEqualSourceSinkCallContext`
Convert more queries to the new dataflow library
…ataflow library" This reverts commit b18c7b4. This change broke some tests.
Revert "Convert DanglingCaptureWhenReturningLambdaObject to use new dataflow library"
Observe that `sizeof(...)` might not occur as a dataflow node if it has a parent node with a concrete value. That value will be a dataflow node instead. Hence, the query has be changed to check for expressions where `sizeof(...)` is a child of an expression with a concrete value.
There was a problem hiding this comment.
Pull request overview
This PR assembles pre-2.22.4 query changes to help bisect a performance regression.
Changes:
- Migrates five CERT queries to the new data-flow API.
- Broadens ARR39-C source matching and updates path baselines.
- Refreshes test expectations for extractor/model changes.
Outstanding: Missing change note, stale ARR39-C compiler baselines, outdated QLDoc, and a newly accepted INT31-C false positive.
Show a summary per file
| File | Description |
|---|---|
cpp/common/src/codingstandards/cpp/Loops.qll |
Updates unknown diagnostic location handling. |
cpp/common/test/rules/usecanonicalorderformemberinit/UseCanonicalOrderForMemberInit.expected |
Refreshes initializer representations. |
cpp/autosar/test/rules/A13-5-3/UserDefinedConversionOperatorsShouldNotBeUsed.expected |
Updates conversion-operator representation. |
c/misra/test/rules/RULE-2-4/UnusedTagDeclaration.expected |
Removes the macro-generated result. |
c/misra/test/rules/RULE-2-4/test.c |
Reclassifies the macro case as compliant. |
c/cert/test/rules/INT31-C/test.c |
Updates time_t result annotations. |
c/cert/test/rules/INT31-C/IntegerConversionCausesDataLoss.expected |
Adds two conversion results. |
c/cert/src/rules/FIO45-C/ToctouRaceConditionsWhileAccessingFiles.ql |
Migrates local data flow. |
c/cert/test/rules/FIO45-C/ToctouRaceConditionsWhileAccessingFiles.expected |
Removes the deprecation warning. |
c/cert/src/rules/ERR30-C/SetlocaleMightSetErrno.ql |
Migrates local data flow. |
c/cert/test/rules/ERR30-C/SetlocaleMightSetErrno.expected |
Removes the deprecation warning. |
c/cert/src/rules/ERR30-C/ErrnoReadBeforeReturn.ql |
Migrates local data flow. |
c/cert/test/rules/ERR30-C/ErrnoReadBeforeReturn.expected |
Removes the deprecation warning. |
c/cert/src/rules/ARR39-C/DoNotAddOrSubtractAScaledIntegerToAPointer.ql |
Migrates taint tracking and broadens sources. |
c/cert/test/rules/ARR39-C/DoNotAddOrSubtractAScaledIntegerToAPointer.expected |
Updates the path graph. |
c/cert/src/rules/ARR37-C/DoNotUsePointerArithmeticOnNonArrayObjectPointers.ql |
Migrates global data flow. |
c/cert/test/rules/ARR37-C/DoNotUsePointerArithmeticOnNonArrayObjectPointers.expected |
Updates increment/decrement paths. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Suppressed comments (2)
c/cert/src/rules/ARR39-C/DoNotAddOrSubtractAScaledIntegerToAPointer.ql:68
- The new source matching and data-flow API change the ARR39-C path graph, but the compiler-specific baselines (
.expected.clang,.expected.gcc, and.expected.qcc) still contain the old graph and the old line-27sizeofsource. Update all three baselines as well so compiler-validation runs do not compare against stale results.
exists(this.getValue()) and
this.getAChild*().(SizeofExprOperator).getExprOperand().getType().getSize() > 1
or
exists(this.getValue()) and
this.getAChild*().(SizeofTypeOperator).getTypeOperand().getSize() > 1
c/cert/src/rules/ARR39-C/DoNotAddOrSubtractAScaledIntegerToAPointer.ql:68
- This now also matches constant-valued ancestor expressions containing
sizeof; the updated baseline at line 27 confirms that a division expression is aScaledIntegerExpr. The class QLDoc still says onlysizeofexpressions are represented, so update it to describe the broader set.
exists(this.getValue()) and
this.getAChild*().(SizeofExprOperator).getExprOperand().getType().getSize() > 1
or
exists(this.getValue()) and
this.getAChild*().(SizeofTypeOperator).getTypeOperand().getSize() > 1
- Files reviewed: 17/17 changed files
- Comments generated: 2
- Review effort level: Balanced
| exists(this.getValue()) and | ||
| this.getAChild*().(SizeofExprOperator).getExprOperand().getType().getSize() > 1 |
| } | ||
| if (now != (time_t)-1) { // COMPLIANT | ||
|
|
||
| if (now != (time_t)-1) { // COMPLIANT[FALSE_POSITIVE] |
|
/test-performance |
|
🏁 Beep Boop! Performance testing for this PR has been initiated. Please check back later for results. Note that the query package generation step must complete before testing will start so it might be a minute. |
|
🏁 Beep Boop! Performance testing complete! See below for performance of the last 3 runs vs your PR. Times are based on predicate performance. You can find full graphs and stats in the PR that was created for this test in the release engineering repo. 🏁 Below are the slowest predicates for the last 2 releases vs this PR. |
|
/test-performance |
|
🏁 Beep Boop! Performance testing for this PR has been initiated. Please check back later for results. Note that the query package generation step must complete before testing will start so it might be a minute. |
|
🏁 Beep Boop! Performance testing complete! See below for performance of the last 3 runs vs your PR. Times are based on predicate performance. You can find full graphs and stats in the PR that was created for this test in the release engineering repo. 🏁 Below are the slowest predicates for the last 2 releases vs this PR. |
|
/test-performance |
|
🏁 Beep Boop! Performance testing for this PR has been initiated. Please check back later for results. Note that the query package generation step must complete before testing will start so it might be a minute. |
Description
This is every change up to c5c6c58 from PRs #1184, #1179, etc, which I suspect is the commit causing a performance regression.
Change request type
.ql,.qll,.qlsor unit tests)Rules with added or modified queries
Release change checklist
A change note (development_handbook.md#change-notes) is required for any pull request which modifies:
If you are only adding new rule queries, a change note is not required.
Author: Is a change note required?
🚨🚨🚨
Reviewer: Confirm that format of shared queries (not the .qll file, the
.ql file that imports it) is valid by running them within VS Code.
Reviewer: Confirm that either a change note is not required or the change note is required and has been added.
Query development review checklist
For PRs that add new queries or modify existing queries, the following checklist should be completed by both the author and reviewer:
Author
As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
Reviewer
As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.